<HTML><HEAD><TITLE>concat_atoms(+Src1, +Src2, -Dest)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Strings and Atoms</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>concat_atoms(+Src1, +Src2, -Dest)</H1>
Succeeds if Dest is the concatenation of Src1 and Src2.
It is more efficient to use concat_strings/3 whenever possible.


<DL>
<DT><EM>Src1</EM></DT>
<DD>Atom.
</DD>
<DT><EM>Src2</EM></DT>
<DD>Atom.
</DD>
<DT><EM>Dest</EM></DT>
<DD>Atom or variable.
</DD>
</DL>
<H2>Description</H2>
   Dest is unified with the concatenation of Src1 and Src2.
   The use of this predicate is discouraged in favour of concat_strings/3,
   because the creation of new atoms involves entering them into a
   dictionary whose garbage collection is relatively expensive.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>concat_atoms(+, +, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Either (or both) of Src1 and Src2 is not instantiated    (non-coroutine mode only).
<DT><EM>(5) type error </EM>
<DD>Either (or both) of Src1 and Src2 is instantiated, but not    to an atom.
<DT><EM>(5) type error </EM>
<DD>Dest is neither an atom nor a variable.
</DL>
<H2>Examples</H2>
<PRE>
Success:
      concat_atoms(abc,def,abcdef).

      [eclipse]: [user].
       filename(File,Full) :-
            name(File,L),
            member(0'.,L) -&gt; Full = File ;
                          concat_atoms(File,'.pl',Full).
       user compiled 208 bytes in 0.00 seconds
      yes.
      [eclipse]: filename(a,P), filename('b.pl',F).
      P = 'a.pl'
      F = 'b.pl'
      yes.

Fail:
      concat_atoms(ab,bc,abc).

Error:
      concat_atoms(art,X,artpaul).      (Error 4).
      concat_atoms(art,"paul",X).       (Error 5).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/stratom/concat_strings-3.html">concat_strings / 3</A>, <A HREF="../../kernel/stratom/append_strings-3.html">append_strings / 3</A>, <A HREF="../../kernel/stratom/atom_string-2.html">atom_string / 2</A>
</BODY></HTML>
